<?php
/**
 * class App_Model_Mail
 *
 * @author kim
 */
class App_Model_Mail
{
    protected $_mail = null;

    /**
     * construct
     */
    public function __construct()
    {
        set_time_limit(30);
        $config = array(
            'auth' => 'login',
            'username' => 'xqpm@163.com',
            'password' => 'kimkem1984',
        );
        $transport = new Zend_Mail_Transport_Smtp('smtp.163.com', $config);
        Zend_Mail::setDefaultTransport($transport);

        $mail = new Zend_Mail('utf-8');
        $mail->setFrom('xqpm@163.com', 'dine.com');
        $this->_mail = $mail;
    }

    /**
     * send mail
     *
     * @param string $to the recipient email address
     * @param string $subject email subject
     * @param string $body email body
     * @return boolean
     */
    public function send($to, $subject = '', $body = '')
    {
        $mail = $this->_mail;
        $mail->setSubject($subject);
        $mail->addTo($to, $to);
        $mail->setBodyHtml($body);
        return $mail->send();
    }

}